import { ref } from '@vue/runtime-core'
import { game } from '../../Game'

export const useMapScroll = () => {
  const viewHeight = 765
  const mapY1 = ref(0)
  const mapY2 = ref(-viewHeight)
  const speed = 5
  game.ticker.add(() => {
    mapY1.value += speed
    mapY2.value += speed
    if(mapY1.value >= viewHeight) {
      mapY1.value = -viewHeight
    }else if(mapY2.value >= viewHeight) {
      mapY2.value = -viewHeight
    }
  })
  return {
    mapY1,
    mapY2
  }
}
